//
//  CTextField.h
//  Hipay_Business
//
//  Created by Mac on 16/7/1.
//  Copyright © 2016年 展鸿科技. All rights reserved.
//

#import <UIKit/UIKit.h>

typedef enum : NSUInteger {
    CTextFieldInputTypeDefault          = 1,
    CTextFieldInputTypePassword         = 1 << 1,
    CTextFieldInputTypeNum              = 1 << 2,
    CTextFieldInputTypeABC              = 1 << 3,
    CTextFieldInputTypeHanz             = 1 << 4,
    CTextFieldInputTypePhone            = 1 << 5,
    CTextFieldInputTypeCertificates     = 1 << 6,
    CTextFieldInputTypeMoney            = 1 << 7,
    CTextFieldInputTypeCardID           = 1 << 8,
} CTextFieldInputType;

@interface CTextField : UITextField

@property (nonatomic, strong) void (^changeBlock)(NSString *);

/*!
 * @abstract 参考 CTextFieldInputType
 * @discussion
 */
@property (nonatomic) CTextFieldInputType inputType;

/*!
 * @abstract 最终值
 * @discussion 只读，值一般与text同步，当设置过分隔字符后，value是删除分隔字符后的值
 */
@property (nonatomic, readonly, strong) NSString *value;

@property (nonatomic, strong) NSString *firstValue;

/*!
 * @abstract 空的提示信息
 * @discussion 校验
 */
@property (nonatomic, strong) NSString *nullMsg;

/*!
 * @method setMaxLength
 * @abstract 最长长度
 * @discussion 设置最长长度以及提示信息
 * @param length 最长长度
 * @param LengthChangeBlock  长度变换block
 * @result
 */
- (void) setMaxLength:(NSInteger) length LengthChangeBlock:(void(^)(NSInteger))block;

/*!
 * @method setMinLength
 * @abstract 最短长度
 * @discussion 设置最短长度以及提示信息
 * @param length 最短长度
 * @param msg    提示信息
 * @result
 */
- (void) setMinLength:(NSInteger) length msg:(NSString *)msg;

/*!
 * @method setPerSplitCount
 * @abstract 分隔字符串
 * @discussion 每几个字分隔，做清晰处理
 * @param count 每分隔字符个数
 * @param separator 分隔符
 * @result
 */
- (void) setPerSplitCount:(NSInteger) count separator:(NSString *)separator;

/*!
 * @method verfiy
 * @abstract 简单的验证
 * @discussion
 * @param
 * @result 返回成功与否
 */
- (BOOL) verfiy;
@end
